<script name="compile">
    function templateCompile(data) {
        var defaultData = {
            title: "提示",
            type: "module",
            popupType:"msg",
            icon:false,
            formType:0,
            value:"",
            width:"800px",
            height:"350px",
            maxlength: 140,
            verifyList:false
        };
        var callback = {
            success: true,
            result: Object.assign(defaultData, data)
        };
        if (!data.content) {
            return {
                success:false,
                result: "请输入要提示的内容"
            };
        }
        return callback;
    }
</script>
<script name="templateScript">
    <% if ( popupType == 'msg' ) { %>
        popup.msg(<%- content %>, {
            <% if (icon) { %>
                icon: <%- icon %>,
            <% } %>
        },function(){
            //&&scriptchildren&&
        }); 
    <% } else if( popupType == 'alert' ){ %> 
        popup.alert(<%- content %>, {
            <% if (icon) { %>
                icon: <%- icon %>,
            <% } %>
        }, function (index) {
            //&&scriptchildren&&
            popup.close(index);
        });
    <% } else if( popupType == 'confirm' ){ %> 
        popup.confirm(<%- content %>, { 
            <% if (icon) { %>
                icon: <%- icon %>,
            <% } %>
            title: "<%- title %>" }, function (index) {
            //&&scriptchildren&&
            popup.close(index);
        });
    <% } else if( popupType == 'prompt' ){ %> 
        popup.prompt({
            formType: <%- formType %>,//支持0（文本）默认1（密码）2（多行文本）
            value: <%- value %>,
            title: "<%- title %>",
            maxlength: <%- maxlength %>,
            area: ["<%- width %>", "<%- height %>"] //自定义文本域宽高
        }, function (value, index, elem) {
            <% if (verifyList && verifyList.length > 0) { %>
                <% verifyList.forEach(function(item,index){ %>
                    if (<%- item.rule %>.test(value)) {
                        popup.msg("<%- item.prompt %>");
                        return false;
                    }
                <% }); %>
            <% } %>
            //&&scriptchildren&&
            popup.close(index);
        });
    <% } %>
</script>